<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>个人文章详情</title>
    <link href="images/title.ico" rel="shortcut icon">
    <link rel="stylesheet" href="css/detail.css">
    <script src="js/jquery.main.js"></script>
</head>
<body>
<div id="header">
</div>
<div id="body">
    <div class="body_center">
        <div class="center_left">
            <a  href="user_personal.action">个人资料</a>
            <a  href="artical_like.action">我的收藏</a>
            <a  href="artical_myartical.action" class="aa" >我的文章</a>
            <a  href="user_favorite.action">我的关注</a>
            <a  href="user_fans.action">我的粉丝</a>
            <a  href="" id="aperson" target="_blank">个人主页</a>
        </div>
        <div class="center_center">
            <div class="center_center_header">
                <div class="atitle"><b></b></div>
                <div class="articaldesc">
                    <div class="atime"></div>
                    <div class="auname"><a href="user_personal.action" style="text-decoration: none;color: #00a2d4">
                    </a></div>
                    <div class="acatagory"></div>
                </div>
            </div>
            <div class="context"></div>
        </div>
    </div>
</div>
<script>

    //加载头部文件
    $("#header").load("Html/personal_head.html");

    //拿到地址栏的aitical_id的值
    function getParams(key) {
        var reg = new RegExp("(^|&)" + key + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) {
            return unescape(r[2]);
        }
        return null;
    };

    $(function () {

        var artical_id = getParams("artical_id");

        //发送ajax请求获取数据
        $.ajax({
            url:"artical_getArticalById.action",
            type:"post",
            dataType:"json",
            data:{"artical_id":artical_id},
            success:function (artical) {

                //个人用户名称显示
                $(".a1").html("个人中心("+artical.user.uname+")");

                //显示数据
                $(".atitle b").html(artical.artical_title);
                $(".atime").html(artical.artical_time);
                $(".auname a").html(artical.user.uname);
                $(".context").html(artical.artical_context);
                $("#aperson").attr("href","person.html?uid="+artical.user.uid);

                $.ajax({
                    url:"artical_GetCataById.action",
                    type:"post",
                    dataType:"json",
                    data:{"parentid":artical.catagory.parentid},
                    success:function (catagory) {
                        $(".acatagory").html(catagory.cname+"——"+artical.catagory.cname);
                    }
                })

            }
        })
    })

</script>
</body>
</html>